#include "Stdafx.h"
#include "DynamicImage.h"

class DrawingManager
{
public:
	DrawingManager(Ogre::SceneManager* _mSceneMgr, Ogre::Camera* _mCamera, int _useStroke){
		mSceneMgr = _mSceneMgr;
		mCamera = _mCamera;
		isDrawing = false;
		brushNum = 0;
		footprintid = 0;
		drawingFootprintId = 0;
		trailRenderingId = 0;
		useStroke = _useStroke;
		clearBuffer =  false;
		initMaterial("footprintMaterial01", "footprintTexture01", "..\\..\\media\\materials\\textures\\f01.png");
		initMaterial("footprintMaterial02", "footprintTexture02", "..\\..\\media\\materials\\textures\\f02.png");
		initMaterial("footprintMaterial03", "footprintTexture03", "..\\..\\media\\materials\\textures\\f03.png");

		initMaterial("TrailRendererTex", "TrailRendererTex", "..\\..\\media\\materials\\textures\\trail.png");
	};
	~DrawingManager(){}; 

	void drawChineseBrush();
	void addFootprint( Ogre::Real x , Ogre::Real y , Ogre::Real dryness );
	void addTrailRendering( Ogre::Real x , Ogre::Real y);
	void endBrush();
	void update(float timeSinceLastFrame);
	void update(float timeSinceLastFrame, Ogre::Vector2 mousePosition, int _useStroke);
	bool isDrawingBrush();
	bool clearAllBrush();
	void setDrawing();
	void setDrawing(bool _isDrawing);
	void initMaterial( Ogre::String materialName, Ogre::String textureName, Ogre::String path );

	int useStroke;
	std::deque<DynamicImage*> trailRenderingVector;
	int trailRenderingId;
	bool clearBuffer;
protected:
private:
	Ogre::Viewport *mCamView;
	Ogre::SceneManager* mSceneMgr;
	Ogre::Camera* mCamera;

	bool isDrawing;
	int brushNum;
	int footprintid;
	int drawingFootprintId;
	std::vector<Ogre::Vector3> cursorPoints;
	std::vector<DynamicImage*> footprintsVector;
	
};
